import Mock from 'mockjs'
const Random = Mock.Random;

// mock一组数据

const produceNewsData = function() {
    let articles = [];

    for (let i = 0; i < 100; i++) {
        let newArticleObject = {
            cataId: Random.character('abcdefghigklmnopqrstuvwxyz') + Random.natural(), //编号
            questionType: Random.integer(1, 3), //  Random.csentence( min, max )题目编号
            // Random.dataImage( size, text ) 生成一段随机的 Base64 图片编码
            // number: Random.dataImage('300x250', 'mock的图片'),
            number: Random.character('abcdefghigklmnopqrstuvwxyz') + Random.natural(6007199254740992, 1009007199254740992),
            addDate: Random.date() + ' ' + Random.time(), // Random.date()指示生成的日期字符串的格式,默认为yyyy-MM-dd；Random.time() 返回一个随机的时间字符串
            totalSeconds: Random.date('SS'), //答题时间
            accuracyRate: Random.integer(60, 100), //正确率
            chkUser: Random.cname(), //录入人
            difficulty: Random.character('12'),
            tags: Random.ctitle(2),
            subjectName: Random.ctitle(2),
            directoryName: Random.ctitle(2),
            direction: Random.ctitle(2),

        }
        articles.push(newArticleObject)
    }
    return {
        articles: articles,
    }
}


// Mock.mock("url",'type',dataRes);
Mock.mock("/getData", 'get', produceNewsData)
    // Mock.mock("/postData", 'post', function(options) {
    //     console.log(options); // 这是发送post请求时所传递给后台的数据
    //     return {
    //         text: "这是发起post请求返回的数据"
    //     }
    // })